from pywow.worldpacketprotocol import crypt
from pywow.SRP import random_long

K = random_long(40*8)

client = crypt()
server = crypt()

client.setKey(K)
server.setKey(K)

client.enable()
server.enable()

message = "hmac -- Keyed-Hashing for Message Authentication."

print "message = %s" % repr(message)

encrypted = client.encrypt(message)

print "encrypted = %s" % repr(encrypted)

decrypted = server.decrypt(encrypted)

print "decrypted = %s" % repr(decrypted)

if message == decrypted:
 print "All correct (message == decrypted)"
else:
 print "Some errors (message != decrypted)"
